home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Can a structure element be static?
- Date: Mon, 18 Mar 96 22:23:45 GMT
- Organization: none
- Message-ID: <827187825snz@genesis.demon.co.uk>
- References: <4iiqgm$3n3@gryphon.phoenix.net>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4iiqgm$3n3@gryphon.phoenix.net>
- brucew@phoenix.net "Bruce Wedding" writes:
-
- >I was recently asked if a struct element can be static. I
- >replied of course not, since all elements of a struct have to be
- >contiguous, the entire struct has to be static. I then searched
- >the standard. I can't really pin down a spot that would disallow
- >this other than the inference one can draw from the statement
- >that all addresses must be in order.
-
- It is simply a syntax error. If you look at the production rules in
- 6.5.2.1 you will see there is nothing there that allows a
- storage-class-specifier (6.5.1) to appear in a member declaration
- (struct-declaration).
-
- >In any event, I don't own a compiler that will accept a static
- >element, and I've tried it on 5 compilers. The poser claims that
- >such a struct will compile on TC 1.0 for dos and BC 4.5 for dos.
-
- Since it is a syntax error it requires a diganostic from any
- conforming compiler. As always the compiler can still proceeed to generate
- an executable if it wishes.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-